<div class="layui-tab" style="margin-bottom:0">
		<ul class="layui-tab-title">
			<php>if(check_reg_type('username')){</php>
			<li <if condition="$type eq 'username'">class="layui-this"</if>>用户名注册</li>
			<php>}</php>
			<php>if(check_reg_type('email')){</php>
			<li <if condition="$type eq 'email'">class="layui-this"</if>>邮箱注册</li>
			<php>}</php>
			<php>if(check_reg_type('mobile')){</php>
			<li <if condition="$type eq 'mobile'">class="layui-this"</if>>手机注册</li>
			<php>}</php>
		</ul>
		<div class="layui-tab-content" style="padding-bottom:0">
			<volist name="regSwitch" id="regSwitch">
				<switch name="regSwitch">
					<case value="username">
						<div class="layui-tab-item <if condition="$type eq 'username'">layui-show</if>">
						<form method="post" id="register_username" action="{:U('home/member/register',array('type'=>'username'))}" class="layui-form">
							<if condition="$open_invite_register egt 1">
								<div class="layui-from-item" style="background:#FF5722;color:white;padding:10px">
									<eq name="open_invite_register" value="1">有邀请码的用户才能注册<else/>可用邀请码注册，也可以普通注册</eq>
								</div>
								<div class="layui-form-item" id="username_reg">
						        	<input type="text" id="code" check-url="{:U('home/member/checkInviteCode')}"  placeholder="邀请码"  value="" name="code" required="" lay-verify="registercode" autocomplete="off" class="layui-input">
						        </div>
							</if>
							<div class="layui-form-item" id="username_reg">
									<input type="text" id="username" onblur="setNickname(this);" check-url="{:U('home/member/checkAccount')}"  placeholder="输入用户名"  value="" name="username" required="" lay-verify="registerusername" autocomplete="off" class="layui-input" />
									<input type="hidden" id="username_type" name="reg_type" value="username" />
							</div>
							<!--用户名注册end-->
							<!--注册通用start-->
							<div class="layui-form-item">
									<input type="text" id="nickname" name="nickname" required="" lay-verify="registernickname" autocomplete="off" class="layui-input" check-url="{:U('home/member/checkNickname')}" placeholder="输入昵称" />
							</div>
							
							<div class="layui-form-item">
								<input type="password" id="password" name="password" placeholder="输入密码" required="" lay-verify="registerpassword" autocomplete="off" class="layui-input" check-length="6,12" />
							</div>
							
							<if condition="check_verify_open('reg')">
								<div class="layui-form-item">
									<div class="layui-row">
										<div class="layui-col-xs7">
											<input type="text" id="verifyCode" errormsg="请填写正确的验证码" name="verify" placeholder="输入验证码" required="" lay-verify="registerverf" autocomplete="off" class="layui-input" />
										</div>
										<div class="layui-col-xs5" style="padding-left:10px">
											<img class="verifyimg reloadverify img-responsive" alt="点击切换" src="{:U('verify')}" style="border: 1px solid #ccc;height:38px;cursor:pointer;width:100%">
										</div>
									</div>
								</div>
							</if>
							
							<div class="layui-form-item">
								<button class="layui-btn" style="width:100%" lay-filter="register_username" lay-submit>立即注册</button>
								<a class="layui-btn layui-btn-primary" onclick="parent.layer.closeAll();parent.$('[data-role=do_login]').click();" style="width:100%;margin-left:0;margin-top:10px;">已有账户，登录
								</a>
							</div>
							<!--注册通用end-->
						</form>
						</div>
					</case>
					<case value="email">
						<div class="layui-tab-item <if condition="$type eq 'email'">layui-show</if>">
						<form method="post" id="register_email" action="{:U('home/member/register',array('type'=>'email'))}" class="layui-form ">
							<!--邮箱注册-->
							<if condition="$open_invite_register egt 1">
								<div class="layui-from-item" style="background:#FF5722;color:white;padding:10px">
									<eq name="open_invite_register" value="1">有邀请码的用户才能注册<else/>可用邀请码注册，也可以普通注册</eq>
								</div>
								<div class="layui-form-item" id="username_reg">
						        	<input type="text" id="code2" check-url="{:U('home/member/checkInviteCode')}"  placeholder="邀请码"  value="" name="code" required="" lay-verify="registercode" autocomplete="off" class="layui-input">
						        </div>
							</if>
							<div class="layui-form-item" id="email_reg">
								<input type="text" id="email" check-url="{:U('home/member/checkAccount')}" placeholder="输入邮箱账号" value="" name="username" required="" lay-verify="registeremail" autocomplete="off" class="layui-input" />
								<input type="hidden" id="email_type" name="reg_type" value="email">
							</div>
							<php>if(modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 2){</php>
							<div class="layui-form-item" id="email_reg_verf">
								<div class="layui-row">
									<div class="layui-col-xs7">
										<input type="number" id="" name="reg_verify" lay-verify="number" placeholder="输入邮箱验证码" class="layui-input" />
									</div>
									<div class="layui-col-xs5" style="padding-left:10px">
										<button class="layui-btn layui-btn-primary layui-btn-fluid" data-role="getVerify" style="">发送验证码</button>
									</div>
								</div>
							</div>
							<php>}</php>
							<!--邮箱注册end-->
							<!--注册通用start-->
							<div class="layui-form-item">
								<input type="text" id="nickname" name="nickname" required="" placeholder="输入昵称" lay-verify="registernickname" autocomplete="off" class="layui-input" check-url="{:U('home/member/checkNickname')}" />
							</div>
							
							<div class="layui-form-item">
									<input type="password" id="password" name="password" required="" placeholder="输入密码" lay-verify="registerpassword" autocomplete="off" class="layui-input" check-length="6,30" />
							</div>
							
							<if condition="check_verify_open('reg')">
								<div class="layui-form-item">
									<div class="layui-row">
										<div class="layui-col-xs7">
											<input type="text" id="verifyCode" errormsg="请填写正确的验证码" placeholder="输入验证码" name="verify" required="" lay-verify="registerverf" autocomplete="off" class="layui-input" />
										</div>
										<div class="layui-col-xs5" style="padding-left:10px">
											<img class="verifyimg reloadverify img-responsive" alt="点击切换" src="{:U('verify')}" style="border: 1px solid #ccc;height:38px;cursor:pointer;width:100%">
										</div>
									</div>
								</div>
							</if>
							
							<div class="layui-form-item">
								<button class="layui-btn" style="width:100%" lay-filter="register_email" lay-submit>立即注册</button>
								<a class="layui-btn layui-btn-primary" onclick="parent.layer.closeAll();parent.$('[data-role=do_login]').click();" style="width:100%;margin-left:0;margin-top:10px;">已有账户，登录
								</a>
							</div>
							<!--注册通用end-->
						</form>
						</div>
					</case>
					<case value="mobile">
						<div class="layui-tab-item <if condition="$type eq 'mobile'">layui-show</if>">
						<form method="post" id="register_mobile" action="{:U('home/member/register',array('type'=>'mobile'))}" class="layui-form ">
							<!--手机注册-->
							<if condition="$open_invite_register egt 1">
								<div class="layui-from-item" style="background:#FF5722;color:white;padding:10px">
									<eq name="open_invite_register" value="1">有邀请码的用户才能注册<else/>可用邀请码注册，也可以普通注册</eq>
								</div>
								<div class="layui-form-item" id="username_reg">
						        	<input type="text" id="code3" check-url="{:U('home/member/checkInviteCode')}"  placeholder="邀请码"  value="" name="code" required="" lay-verify="registercode" autocomplete="off" class="layui-input">
						        </div>
							</if>
							<div class="layui-form-item" id="mobile_reg">
									<input type="text" id="mobile" check-url="{:U('home/member/checkAccount')}"  placeholder="输入手机号" value="" name="username" required="" lay-verify="registermobile" autocomplete="off" class="layui-input" />
									<input type="hidden" id="mobile_type" name="reg_type" value="mobile">
							</div>
							<php>if(modC('MOBILE_VERIFY_TYPE', 0, 'USERCONFIG') == 1){</php>
							<div class="layui-form-item" id="mobile_reg_verf">
								<div class="layui-row">
									<div class="layui-col-xs7">
										<input type="number" id="" name="reg_verify" lay-verify="number" placeholder="输入手机验证码" class="layui-input" />
									</div>
									<div class="layui-col-xs5" style="padding-left:10px">
										<button class="layui-btn layui-btn-primary layui-btn-fluid" data-role="getVerify" style="">发送验证码</button>
									</div>
								</div>
							</div>
							<php>}</php>
							<!--手机注册end-->
							<!--注册通用start-->
							<div class="layui-form-item">
								<input type="text" id="nickname" name="nickname" required="" placeholder="输入昵称" lay-verify="registernickname" autocomplete="off" class="layui-input" check-url="{:U('home/member/checkNickname')}" />
							</div>
							
							<div class="layui-form-item">
								<input type="password" id="password" name="password" required="" placeholder="输入密码" lay-verify="registerpassword" autocomplete="off" class="layui-input" check-length="6,30" />
							</div>
							
							<if condition="check_verify_open('reg')">
								<div class="layui-form-item">
									<div class="layui-row">
										<div class="layui-col-xs7">
											<input type="text" id="verifyCode" errormsg="请填写正确的验证码" placeholder="输入验证码" name="verify" required="" lay-verify="registerverf" autocomplete="off" class="layui-input" />
										</div>
										<div class="layui-col-xs5" style="padding-left:10px">
											<img class="verifyimg reloadverify img-responsive" alt="点击切换" src="{:U('verify')}" style="border: 1px solid #ccc;height:38px;cursor:pointer;width:100%">
										</div>
									</div>
								</div>
							</if>
							
							<div class="layui-form-item">
								<button class="layui-btn" style="width:100%" lay-filter="register_mobile" lay-submit>立即注册</button>
								<a class="layui-btn layui-btn-primary" onclick="parent.layer.closeAll();parent.$('[data-role=do_login]').click();" style="width:100%;margin-left:0;margin-top:10px;">已有账户，登录
								</a>
							</div>
							<!--注册通用end-->
						</form>
						</div>
					</case>
				</switch>
			</volist>
		</div>
	</div>
	<div class="cut-off">
		<div class="chose-other">
			或使用以下方式登录
		</div>
	</div>
	<div class="layui-form-item fly-form-app">
		{:hook('synclogin')}
	</div>
</block>

<block name="script">
<script type="text/javascript">
	if (MID == 0) {
		function setNickname(obj) {
			var text = jQuery.trim($(obj).val());
			if (text != null && text != '') {
				$('#nickname').val(text);
			}
		}

		$(function () {
			var verifyimg = $(".verifyimg").attr("src");
			$(".reloadverify").click(function () {
				if (verifyimg.indexOf('?') > 0) {
					$(".verifyimg").attr("src", verifyimg + '&random=' + Math.random());
				} else {
					$(".verifyimg").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
				}
			});

			$("[data-role='getVerify']").click(function () {
				var $this = $(this);
				var account = $(this).parents(".layui-tab-item").find('[name="username"]').val();
				var type = $(this).parents(".layui-tab-item").find('[name="reg_type"]').val();
				if(type == 'mobile'){
					if($(this).text() != '发送验证码'){
						return false;
					}
				}else if(type == 'email'){
					if($(this).text() != '发送验证码'){
						return false;
					}
				}
				$(this).attr('disabled',true);
				$.post("{:U('home/verify/sendVerify')}", {account: account, type: type, action: 'member', todo: 'register'}, function (res) {
					if (res.status) {
						if(type == 'email'){
							DecTime1.obj = $this;
							DecTime1.time = "{: modC('SMS_RESEND','60','USERCONFIG')}";
							$this.attr('disabled',true)
							DecTime1.dec_time();
						}else{
							DecTime.obj = $this;
							DecTime.time = "{: modC('SMS_RESEND','60','USERCONFIG')}";
							$this.attr('disabled',true);
							DecTime.dec_time();
						}
						layer.msg(res.info, {icon: 1, fixed: true, offset: '80%', time: 1000});
					}
					else {
						if(type == 'email'){
							DecTime1.obj = $this;
							DecTime1.time = "{: modC('SMS_RESEND','60','USERCONFIG')}";
							$this.attr('disabled',true)
							DecTime1.dec_time();
						}else{
							DecTime.obj = $this;
							DecTime.time = "{: modC('SMS_RESEND','60','USERCONFIG')}";
							$this.attr('disabled',true);
							DecTime.dec_time();
						}
						layer.msg(res.info, {icon: 2, fixed: true, offset: '80%', time: 1000});
					}
				})
			});
		});
	}
	
	var DecTime = {
		obj:0,
		time:0,
		dec_time : function(){
			if(this.time > 0){
				this.obj.text(this.time--+'S');
				setTimeout("DecTime.dec_time()",1000);
			}else{
				this.obj.text('发送验证码');
				this.obj.attr('disabled',false);
			}

		}
	}
	var DecTime1 = {
		obj:0,
		time:0,
		dec_time : function(){
			if(this.time > 0){
				this.obj.text(this.time--+'S');
				setTimeout("DecTime1.dec_time()",1000);
			}else{
				this.obj.text('发送验证码');
				this.obj.attr('disabled',false);
			}

		}
	}
</script>
</block>